﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.AlfaDirectFolder
{
    /// <summary>
    /// ТАБЛИЦА «SUM_BALANCE» - ПОЗИЦИИ
    /// Ключевые поля: treaty, p_code
    /// </summary>
    class SumBalance : INotifyPropertyChanged
    {
        #region Private

        private int _treaty;
        private string _pCode;
        private string _placeCode;
        private double _incomeRest;
        private double _realRest;
        private double _planRest;
        private double _turnOver;
        private int _paperNo;
        private double _forwordRest;
        private double _realVol;
        private double _fowordVol;
        private double _balForwordVol;
        private double _profitVol;
        private string _accCode;
        private double _prevClose;
        private double _inBids;
        private double _inOffers;
        private double _nettoRest;
        private double _bought;
        private double _sold;
        private double _dailyPl;
        private double _incomePl;
        private double _imcomeVol;
        private double _pProfitVol;
        private double _openVol;
        private double _varMargin;
        private double _varMatginPc;
        private string _ansiName;
        private string _placeName;
        private double _priceStep;
        private double _baordCode;


        #endregion

        #region Public

        /// <summary>
        /// Счет.
        /// </summary>
        public int Treaty
        {
            get { return _treaty; }
            set
            {
                if (_treaty != value)
                    _treaty = value;

                RaisePropertyChanged("Treaty");
            }
        }
        /// <summary>
        /// Код актива.
        /// </summary>
        public string PCode
        {
            get { return _pCode; }
            set
            {
                if (_pCode != value)
                    _pCode = value;

                RaisePropertyChanged("PCode");
            }
        }
        /// <summary>
        /// Код рынка.
        /// </summary>
        public string PlaceCode
        {
            get { return _placeCode; }
            set
            {
                if (_placeCode != value)
                    _placeCode = value;

                RaisePropertyChanged("PlaceCode");
            }
        }
        /// <summary>
        /// Входящий остаток.
        /// </summary>
        public double IncomeRest
        {
            get { return _incomeRest; }
            set
            {
                if (_incomeRest != value)
                    _incomeRest = value;

                RaisePropertyChanged("IncomeRest");
            }
        }
        /// <summary>
        /// Текущий остаток.
        /// </summary>
        public double RealRest
        {
            get { return _realRest; }
            set
            {
                if (_realRest != value)
                    _realRest = value;

                RaisePropertyChanged("RealRest");
            }
        }
        /// <summary>
        /// Плановый остаток.
        /// </summary>
        public double PlanRest
        {
            get { return _planRest; }
            set
            {
                if (_planRest != value)
                    _planRest = value;

                RaisePropertyChanged("PlanRest");
            }
        }
        /// <summary>
        /// Оборот.
        /// </summary>
        public double TurnOver
        {
            get { return _turnOver; }
            set
            {
                if (_turnOver != value)
                    _turnOver = value;

                RaisePropertyChanged("TurnOver");
            }
        }
        /// <summary>
        /// Цифровой код финансового инструмента.
        /// </summary>
        public int PaperNo
        {
            get { return _paperNo; }
            set
            {
                if (_paperNo != value)
                    _paperNo = value;

                RaisePropertyChanged("PaperNo");
            }
        }
        /// <summary>
        /// Чистый остаток (позиция).
        /// </summary>
        public double ForwordRest
        {
            get { return _forwordRest; }
            set
            {
                if (_forwordRest != value)
                    _forwordRest = value;

                RaisePropertyChanged("ForwordRest");
            }
        }
        /// <summary>
        /// Текущая стоимость.
        /// </summary>
        public double RealVol
        {
            get { return _realVol; }
            set
            {
                if (_realVol != value)
                    _realVol = value;

                RaisePropertyChanged("RealVol");
            }
        }
        /// <summary>
        /// Чистая стоимость.
        /// </summary>
        public double FowordVol
        {
            get { return _fowordVol; }
            set
            {
                if (_fowordVol != value)
                    _fowordVol = value;

                RaisePropertyChanged("FowordVol");
            }
        }
        /// <summary>
        /// Учетная стоимость.
        /// </summary>
        public double BalForwordVol
        {
            get { return _balForwordVol; }
            set
            {
                if (_balForwordVol != value)
                    _balForwordVol = value;

                RaisePropertyChanged("BalForwordVol");
            }
        }
        /// <summary>
        /// Нереализованные прибыль/убыток.
        /// </summary>
        public double ProfitVol
        {
            get { return _profitVol; }
            set
            {
                if (_profitVol != value)
                    _profitVol = value;

                RaisePropertyChanged("ProfitVol");
            }
        }
        /// <summary>
        /// Портфель.
        /// </summary>
        public string AccCode
        {
            get { return _accCode; }
            set
            {
                if (_accCode != value)
                    _accCode = value;

                RaisePropertyChanged("AccCode");
            }
        }
        /// <summary>
        /// Входящая чистая позиция.
        /// </summary>
        public double PrevClose
        {
            get { return _prevClose; }
            set
            {
                if (_prevClose != value)
                    _prevClose = value;

                RaisePropertyChanged("PrevClose");
            }
        }
        /// <summary>
        /// На покупку.
        /// </summary>
        public double InBids
        {
            get { return _inBids; }
            set
            {
                if (_inBids != value)
                    _inBids = value;

                RaisePropertyChanged("InBids");
            }
        }
        /// <summary>
        /// На продажу.
        /// </summary>
        public double InOffers
        {
            get { return _inOffers; }
            set
            {
                if (_inOffers != value)
                    _inOffers = value;

                RaisePropertyChanged("InOffers");
            }
        }
        /// <summary>
        /// Свободная позиция.
        /// </summary>
        public double NettoRest
        {
            get { return _nettoRest; }
            set
            {
                if (_nettoRest != value)
                    _nettoRest = value;

                RaisePropertyChanged("NettoRest");
            }
        }
        /// <summary>
        /// Куплено.
        /// </summary>
        public double Bought
        {
            get { return _bought; }
            set
            {
                if (_bought != value)
                    _bought = value;

                RaisePropertyChanged("Bought");
            }
        }
        /// <summary>
        /// Продано.
        /// </summary>
        public double Sold
        {
            get { return _sold; }
            set
            {
                if (_sold != value)
                    _sold = value;

                RaisePropertyChanged("Sold");
            }
        }
        /// <summary>
        /// Прибыль/убыток дневной.
        /// </summary>
        public double DailyPl
        {
            get { return _dailyPl; }
            set
            {
                if (_dailyPl != value)
                    _dailyPl = value;

                RaisePropertyChanged("DailyPl");
            }
        }
        /// <summary>
        /// Прибыль/убыток входящий.
        /// </summary>
        public double IncomePl
        {
            get { return _incomePl; }
            set
            {
                if (_incomePl != value)
                    _incomePl = value;

                RaisePropertyChanged("IncomePl");
            }
        }
        /// <summary>
        /// Входящая стоимость.
        /// </summary>
        public double ImcomeVol
        {
            get { return _imcomeVol; }
            set
            {
                if (_imcomeVol != value)
                    _imcomeVol = value;

                RaisePropertyChanged("ImcomeVol");
            }
        }
        /// <summary>
        /// %Нереализованные прибыль/убыток.
        /// </summary>
        public double PProfitVol
        {
            get { return _pProfitVol; }
            set
            {
                if (_pProfitVol != value)
                    _pProfitVol = value;

                RaisePropertyChanged("PProfitVol");
            }
        }
        /// <summary>
        /// Стоимость открытой позиции.
        /// </summary>
        public double OpenVol
        {
            get { return _openVol; }
            set
            {
                if (_openVol != value)
                    _openVol = value;

                RaisePropertyChanged("OpenVol");
            }
        }
        /// <summary>
        /// Вариационная маржа.
        /// </summary>
        public double VarMargin
        {
            get { return _varMargin; }
            set
            {
                if (_varMargin != value)
                    _varMargin = value;

                RaisePropertyChanged("VarMargin");
            }
        }
        /// <summary>
        /// Вариационная маржа после пром. клиринга.
        /// </summary>
        public double VarMatginPc
        {
            get { return _varMatginPc; }
            set
            {
                if (_varMatginPc != value)
                    _varMatginPc = value;

                RaisePropertyChanged("VarMatginPc");
            }
        }
        /// <summary>
        /// Короткое название.
        /// </summary>
        public string AnsiName
        {
            get { return _ansiName; }
            set
            {
                if (_ansiName != value)
                    _ansiName = value;

                RaisePropertyChanged("AnsiName");
            }
        }
        /// <summary>
        /// Название рынка.
        /// </summary>
        public string PlaceName
        {
            get { return _placeName; }
            set
            {
                if (_placeName != value)
                    _placeName = value;

                RaisePropertyChanged("PlaceName");
            }
        }
        /// <summary>
        /// Шаг цены.
        /// </summary>
        public double PriceStep
        {
            get { return _priceStep; }
            set
            {
                if (_priceStep != value)
                    _priceStep = value;

                RaisePropertyChanged("PriceStep");
            }
        }
        /// <summary>
        /// Код торгового раздела.
        /// </summary>
        public double BaordCode
        {
            get { return _baordCode; }
            set
            {
                if (_baordCode != value)
                    _baordCode = value;

                RaisePropertyChanged("BaordCode");
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
